<template>
<div>
    <div v-for="(item,index) in goodsArr" :key="index">
        <input type="text" v-model="item.count">
        {{ item.goodsName }}
        <span v-if="item.count==0">卖光了！</span>
    </div>
    <h3>All Number : {{ allCount }} </h3>
    </div>
</template>

<script>
export default {
    props:['goodsArr'],

    data() {
        return {
            // arr:[1,2,3]
        };
    },

    methods: {
        
    },
    computed:{
    allCount(){
       const num =  this.goodsArr.reduce((preValue, curValue) =>  {
           return preValue + +curValue.count
           },0)
        return num
    }
    }
};
</script>

<style lang="scss" scoped>

</style>